import { getPresetConfig, mergeUnoConfig } from '@peng_kai/theme/unocss';
import { defineConfig } from 'unocss';

const config = mergeUnoConfig(getPresetConfig(), {
  safelist: [
    // 国旗，用于语言标识
    'i-circle-flags:de',
    'i-circle-flags:uk',
    'i-circle-flags:es-variant',
    'i-circle-flags:fr',
    'i-circle-flags:in',
    'i-circle-flags:id',
    'i-circle-flags:it',
    'i-circle-flags:jp',
    'i-circle-flags:kr',
    'i-circle-flags:nl',
    'i-circle-flags:pl',
    'i-circle-flags:ru',
    'i-circle-flags:cn',
    'i-circle-flags:cn-hk',
    'i-circle-flags:vn',
    'i-circle-flags:pk',
    'i-circle-flags:th',
    'i-circle-flags:bd',
    'i-circle-flags:br',
  ],
  theme: {
    colors: {
      slate: {
        50: '#EEEFF1',
        100: '#DDDEE4',
        200: '#B8BAC6',
        300: '#969AAB',
        400: '#72768D',
        500: '#565A6B',
        600: '#3E404C',
        700: '#26272E',
        800: '#1D1E24',
        900: '#18181C',
        950: '#131416',
        DEFAULT: '#565A6B',
      },
      brand: {
        50: '#FDF2F2',
        100: '#FBE4E4',
        200: '#F7C5C5',
        300: '#F1A2A2',
        400: '#EA6C6C',
        500: '#B91B1B',
        600: '#A91919',
        700: '#931515',
        800: '#741111',
        900: '#500C0C',
        950: '#350808',
        DEFAULT: '#B91B1B',
      },
      sys: {
        layer: {
          a: '#131416',
          b: '#18181C',
          c: '#1D1E24',
          d: '#26272e',
          e: '#3E404C',
        },
        text: {
          head: '#FFFFFF',
          body: '#848A9D',
          sec: '#72768D',
          ter: '#FFFFFF',
          marker: '#EAB308',
        },
      },
    },
  },
  shortcuts: {
    /* ================ 工具 ================ */
    'flex-between': 'flex justify-between items-center',
    'flex-cneter': 'flex justify-center items-center',
    'flex-start': 'flex justify-start items-center',
    'abs-full': 'absolute left-0 top-0 h-full w-full',

    /* ================ 业务 ================ */
    // 品牌色到黑色的渐变背景
    'bg-brand-to-black': 'bg-gradient-to-r from-brand to-sys-layer-a [--un-gradient-shape:to_right]',
    // 水平分割线，实线
    'divider-h-solid': 'b-t-(1 solid sys-layer-e) my-3 w-full',
    // 垂直分割线，实线
    'divider-v-solid': 'b-l-(1 solid sys-layer-e) mx-3 h-full',
    // 水平分割线，头尾暗中间亮的渐变线
    'divider-h-gradual': 'h-[1px] from-gray-6/10 via-gray-6 to-gray-6/10 bg-gradient-to-r my-3 w-full',
    // 垂直分割线，头尾暗中间亮的渐变线
    'divider-v-gradual': 'w-[1px] from-gray-6/10 via-gray-6 to-gray-6/10 bg-gradient-to-b mx-3 h-full',
    // 页面内容宽度
    'page-content-w-sm': 'w-full mx-auto max-w-320',
    'page-content-w': 'w-full mx-auto max-w-360',
    'page-content-w-lg': 'w-full mx-auto max-w-400',
    // 带下划线黄色文字链接
    'url-yellow-underline': 'text-sys-text-marker underline underline-offset-4 text-sm cursor-pointer',

    'base-title': 'text-5 font-semibold leading-normal text-sys-text-head lt-tablet:text-3.5',
    'base-content': 'text-3.5 leading-normal text-sys-text-body lt-tablet:text-sm',
    'outer-base-margin': 'px-30 lt-desktop1k:px-25 lt-desktop:px-20 lt-mobilel:px-0',
    'card-grey': 'bg-sys-layer-d rounded-lg p-3',
  },
  rules: [
    // 卡片阴影
    ['card-shadow', { 'box-shadow': '0 4px 0 0 #0F0F12' }, { layer: 'components' }],
  ],
});

export default defineConfig(config);
